#include <ostream>

#include <pcl/point_cloud.h>
#include <pcl/point_types.h>
#include <pcl/visualization/cloud_viewer.h>
//#include <pcl/io/ply_io.h>

#include "ModelController.h"
#include "Defines.h"

int main(int argc, char** argv)
{
   ModelController* model_controller = new ModelController();
   if(SUCCESS!=model_controller->init()) {
      std::cerr << "Error initializing Model Controller!" << std::endl;
      return(-1);
   }

   if(SUCCESS!=model_controller->usePlyFile("1-0.ply")) {
      std::cerr << "Error reading .ply file!" << std::endl;
      return(-1);
   }

   //model_controller->generateModel();

   pcl::PointCloud<pcl::PointXYZRGB>::Ptr model(new pcl::PointCloud<pcl::PointXYZRGB>);
   if(SUCCESS!=model_controller->getModel(model)) {
      std::cerr << "Error retrieving model!" << std::endl;
      return(-1);
   }
   
   pcl::visualization::CloudViewer viewer(std::string("Model_Generator_1_02"));
   viewer.showCloud(model);

   while(!viewer.wasStopped()) {

   };
}
